package com.sunyard.manage.controller;

import com.sunyard.dal.bo.PubConfigBO;
import com.sunyard.dal.dto.OtherParamDTO;
import com.sunyard.manage.service.PubConfigService;
import com.sunyard.utils.Response.BaseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "PubConfigController", description = "系统配置Controller")
@Slf4j
@RestController
@RequestMapping("/pubConfig")
public class PubConfigController {

    @Autowired
    PubConfigService pubConfigService;

    @ApiOperation("查询复核权限")
    @RequestMapping(value = "/queryReview", method = RequestMethod.GET)
    @ResponseBody
    public BaseResult<List<OtherParamDTO>> queryReview() {
        return pubConfigService.queryReview();
    }

    @ApiOperation("修改复核权限")
    @RequestMapping(value = "/updateReview", method = RequestMethod.POST)
    @ResponseBody
    public BaseResult updateReview(@RequestBody PubConfigBO pubConfigBO) {
        return pubConfigService.updateReview(pubConfigBO);
    }

    @ApiOperation("查询预警信息")
    @RequestMapping(value = "/queryWarn", method = RequestMethod.GET)
    @ResponseBody
    public BaseResult<List<OtherParamDTO>> queryWarn() {
        return pubConfigService.queryWarn();
    }

    @ApiOperation("修改预警信息")
    @RequestMapping(value = "/updateWarn", method = RequestMethod.POST)
    @ResponseBody
    public BaseResult updateWarn(@RequestBody PubConfigBO pubConfigBO) {
        return pubConfigService.updateReview(pubConfigBO);
    }
}
